<?php

/**
 * @copyright        2017 opencart.cn - All Rights Reserved
 * @author:          Sam Chen <sam.chen@opencart.cn>
 * @created:         2017-08-25 12:54:43
 * @modified by:     Sam Chen <sam.chen@opencart.cn>
 * @modified:        2017-10-26 09:33:41
 */

class ControllerExtensionModuleGdImageCombo extends Controller {
  public function index($setting) {
    if ($this->config->get('is_mobile')) return;

    if (empty($setting['images'])) {
      return;
    }

    if ($this->request->server['HTTPS']) {
      $base = HTTPS_SERVER;
    } else {
      $base = HTTP_SERVER;
    }

    $data['type'] = $setting['type'];

    $data['images'] = array();
    foreach ($setting['images'] as $image) {
      $data['images'][] = array(
        'image' => $base . 'image/' . $image['image'],
        'href' => $image['url'],
      );
    }

    if ($data['images']) {
      return $this->load->view('extension/module/gd_image_combo.tpl', $data);
    }
  }
}
